package view;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class Fehlermeldung extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private String title = null;
	private String meldung = null;
	private JTextArea jTextArea = null;
	private JButton jButton = null;
	/**
	 * This is the default constructor
	 * @param meldung 
	 * @param title 
	 */
	public Fehlermeldung(String title, String meldung) {
		super();
		this.title = title;
		this.meldung = meldung;
		initialize();
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setText("OK");
			jButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					removeWindow();
				}
			});
		}
		return jButton;
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
			gridBagConstraints10.gridx = 0;
			gridBagConstraints10.insets = new Insets(0, 0, 10, 0);
			gridBagConstraints10.gridy = 1;
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.fill = GridBagConstraints.BOTH;
			gridBagConstraints.gridy = 0;
			gridBagConstraints.weightx = 1.0;
			gridBagConstraints.weighty = 1.0;
			gridBagConstraints.insets = new Insets(25, 25, 15, 25);
			gridBagConstraints.gridx = 0;
			jContentPane = new JPanel();
			jContentPane.setLayout(new GridBagLayout());
			jContentPane.add(getJTextArea(), gridBagConstraints);
			jContentPane.add(getJButton(), gridBagConstraints10);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jTextArea	
	 * 	
	 * @return javax.swing.JTextArea	
	 */
	private JTextArea getJTextArea() {
		if (jTextArea == null) {
			jTextArea = new JTextArea();
			jTextArea.setBackground(new Color(238, 238, 238));
			jTextArea.setWrapStyleWord(true);
			jTextArea.setLineWrap(true);
		}
		return jTextArea;
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(437, 200);
		this.setContentPane(getJContentPane());
		this.setTitle("JFrame");
		jTextArea.setText(this.meldung);
		this.setTitle(this.title);
		this.setVisible(true);
	}

	protected void removeWindow() {
		this.setVisible(false);
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
